﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player_TurnAround : MonoBehaviour
{
    float IsRight = -1;   //是否朝左
    float InputDirect;
    Transform trans;
    bool Rotated;
    // Start is called before the first frame update
    void Start()
    {
        trans = GetComponent<Transform>();
    }

    // Update is called once per frame
    void Update()
    {
        InputDirect = (float)(Input.GetAxisRaw("Horizontal"));
        if (IsRight + InputDirect == 0)
        {
            IsRight = InputDirect;
            Rotated = true;
        } else Rotated = false;
        if (Rotated)
        {
            trans.Rotate(0, 180, 0);
        }
    }
    
}
